﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>

<p>The biggest component of jSLCore is ApplicationContainer control. It allows 
all the things to work: bindings, dialogs, navigation and more. You can 
place it where ever you want, but if you do not want any additional futures you can 
use it as the Application.RootFrame:</p>
<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25553/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25553/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">private void</font> Application_Startup(<font color="#0000ff">object</font> sender, <font color="#2b91af">StartupEventArgs</font> e)</li>
<li>{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">var</font> container = <font color="#0000ff">new</font> <font color="#2b91af">ApplicationContainer</font>(<font color="#0000ff">false</font>, UIHelper.GetCurrentWebHostAddress() + <font color="#A31515">@"RootService.svc"</font>);</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;container.NeedContentContainer += () =&gt; <font color="#0000ff">new</font> <font color="#2b91af">MainContentContainer</font>();</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#008000">//container.NeedAuthorizeContainer += () =&gt; new AuthorizeControlWithRegistration(); //Custom authorization</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;RootVisual = container;<font color="#008000">//jSLCore&nbsp;starting</font></li>
<li>} </li>
</ol></font></code></blockquote>
<p>ApplicationContainer constructor has two parameters. First - should 
authorization take place before everything start, or any anonymous user can visit the 
application. The second parameter is the name of the root service which can authorize, 
load constants and so on.</p>
<p>We must implement three things in our application:</p>
<ol>
	<li>RootService - the WCF service derived from 
	jSLCore.Service.jSLAuthorizationServiceBase. Just create the WCF service 
	RootService, delete code-behind file and set &quot;Service&quot; attribute to 
	&quot;jSLCore.Service.jSLAuthorizationServiceBase&quot; 	<br/>
	<img alt="" src="RootServiceSE.jpg" /><img alt="" src="RootService.jpg" /></li>
	<li>MainContentContainer is derived from ContentContainerBase. This is the main 
	control which hosts all the pages of your application (like MasterPage in 
	ASP.NET). You have to override 
	3 methods:
	<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25556/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25556/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">public partial class</font> <font color="#2b91af">MainContentContainer</font> : <font color="#2b91af">ContentContainerBase</font></li>
<li>&nbsp;&nbsp;&nbsp;{</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">public</font>
		<font color="#2b91af">MainContentContainer</font>()</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitializeComponent();</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
		<li></li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">protected override</font>
		<font color="#2b91af">BaseControl</font> GetDefaultPage()</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font>
		<font color="#0000ff">new</font> <font color="#2b91af">StartPage</font>();</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">protected override</font> ContentPresenter GetMainContentPresenter()</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font> mainContent;</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">protected override</font> ContentPresenter GetOkCancelControlContentPresenter()</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font> okCancelPresenter;</li>
		<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
		<li>&nbsp;&nbsp;&nbsp;} </li>
</ol>
		</font></code></blockquote>
	 <blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25555/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25555/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">&lt;</font><font color="#800000">Presentation:ContentContainerBase</font> <font color="#ff0000">x:Class</font><font color="#0000ff">="jSLApp.Client.ApplicationBase.MainContentContainer"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns</font><font color="#0000ff">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:x</font><font color="#0000ff">="http://schemas.microsoft.com/winfx/2006/xaml"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:Presentation</font><font color="#0000ff">="clr-namespace:jSLCore.Client.Presentation;assembly=jSLCore.Client.Presentation"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:Controls</font><font color="#0000ff">="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:jControls</font><font color="#0000ff">="clr-namespace:jSLCore.Client.Presentation.Controls;assembly=jSLCore.Client.Presentation"&gt;</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">&lt;</font><font color="#800000">Controls:DockPanel</font> <font color="#ff0000">LastChildFill</font><font color="#0000ff">="True"&gt;</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">&lt;</font><font color="#800000">ContentPresenter</font> <font color="#ff0000">x:Name</font><font color="#0000ff">="okCancelPresenter"</font> <font color="#ff0000">Controls:DockPanel</font>.<font color="#ff0000">Dock</font><font color="#0000ff">="Bottom"/&gt;</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">&lt;</font><font color="#800000">ContentPresenter</font> <font color="#ff0000">x:Name</font><font color="#0000ff">="mainContent"/&gt;</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">&lt;/</font><font color="#800000">Controls:DockPanel</font><font color="#0000ff">&gt;</font></li>
<li><font color="#0000ff">&lt;/</font><font color="#800000">Presentation:ContentContainerBase</font><font color="#0000ff">&&gt;</font></li>
</ol></font></code></blockquote>
	</li>
	<li>Also we must point the BaseService to the right connection (you can do 
	it in Global.asax):
	<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25560/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25560/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">protected void</font> Session_Start(<font color="#0000ff">object</font> sender, <font color="#2b91af">EventArgs</font> e)</li>
<li>{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;jSLCore.Service.jSLAuthorizationServiceBase.ConnectionString =</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ConfigurationManager.ConnectionStrings[<font color="#A31515">"DBConnectionString"</font>].ConnectionString;</li>
<li>} </li>
</ol></font></code></blockquote></li>
</ol>
</body>

</html>
